package com.pan.controller.Users;

import com.pan.aop.BusinessType;
import com.pan.aop.MyLog;
import com.pan.controller.tools.R1;
import com.pan.service.IUserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/users")
@Tag(name = "UserController",description = "主界面类")
public class UserController {
    @Autowired
    private IUserService userService;


    //获取展示界面成员信息
    @Operation(summary = "获取展示界面成员信息",description = "已删除的不显示")
    @GetMapping
    @MyLog(title = "获取展示界面成员信息",optParam = "无",businessType = BusinessType.SELECT)
    public R1 getSome(){
        return new R1(true,userService.getSome());
    }

    //根据姓名查询成员信息
    @Operation(summary = "根据姓名查询信息",description = "支持模糊查询")
    @GetMapping("/{name}")
    @MyLog(title = "根据姓名查询信息",optParam = "无",businessType = BusinessType.SELECT)
    public R1 getByName(@Parameter(description = "姓名",required = true,example = "猪猪侠") @PathVariable(value = "name") String name ){
        System.out.println("-------------------------------------------------------------------------------------------");
        System.out.println(name);
        System.out.println("-------------------------------------------------------------------------------------------");
        return new R1(true,userService.getByName(name));
    }



}
